import axios from "axios";


/**
 * axios配置工具
 */

//1.创建axios对象
const service=axios.create();

//2.请求拦截
service.interceptors.request.use(config=>{

    return config;
},error => {

    Promise.reject(error);
})

//3.响应拦截
service.interceptors.response.use(response=>{
    //判断code码
    if (response.data.code===40001){
        window.location.replace('/')
    }
    return response.data;
},error => {
    return Promise.reject(error);
})


export default service;
